import { defaultAxios as request } from '@/utils/http';

export function getUsersList(data = {}) {
  return request({
    url: '/auth/list',
    method: 'get',
    params: data,
  });
}

export function getUser(id) {
  return request({
    url: '/auth/findByToken',
    method: 'post',
  });
}

export function saveUser(data = {}, id) {
  if (id) {
    return request({
      url: '/user',
      method: 'put',
      data,
    });
  }

  return request({
    url: `/user/${id}`,
    method: 'put',
    data,
  });
}
